package com.modifiertech.lineage.client.gui.ftbint;

import com.feed_the_beast.ftblib.lib.gui.Panel;
import com.feed_the_beast.ftblib.lib.gui.TextField;
import com.feed_the_beast.ftblib.lib.gui.Theme;
import com.feed_the_beast.ftblib.lib.icon.Color4I;
import com.modifiertech.lineage.Lineage;
import com.modifiertech.lineage.api.PlayerData;
import com.modifiertech.lineage.event.PlayerDataHandler;

public class PanelHeadV2 extends Panel {
    private GuiLineageV2 mainGui;
    private TextField textFieldLevel;
    private PlayerData playerDataRelClient;


    public PanelHeadV2(Panel panel,GuiLineageV2 mainGui) {
        super(panel);
        this.mainGui=mainGui;
        init();
    }

    private void init() {
        initPlayerData();
        initText();

    }

    private void initPlayerData() {
        this.playerDataRelClient = PlayerDataHandler.get(Lineage.proxy.getClientPlayer());
    }

    private void initText() {
        textFieldLevel=new TextField(this);
        textFieldLevel.setText(getLevelString(playerDataRelClient.getLevel()));
        textFieldLevel.setPos(5,5);
    }

    private String getLevelString(long level){
        return "§4§lCurrentLevel : "+level;
    }


    @Override
    public void addWidgets() {
        add(textFieldLevel);
    }

    @Override
    public void alignWidgets() {
        textFieldLevel.setSize(20,10);
        textFieldLevel.setText(getLevelString(playerDataRelClient.getLevel()));
    }

    @Override
    public void drawBackground(Theme theme, int x, int y, int w, int h) {
        Color4I.LIGHT_BLUE.withAlpha(70).withBorder(Color4I.WHITE,true).draw(x, y, w, h);
//        theme.drawPanelBackground(x, y, w, h);
//        GuiEditConfig.COLOR_BACKGROUND.draw(0, 0, w, 40);
    }

}
